package cn.sjtu.design_pattern.singleton;

/**
 * @author syo 2319615164@qq.com
 * @description 静态内部类单例
 * @date 2024/5/16
 * @Copyright syo
 */
public class Singleton03 {
    // 1. 构造函数
    private Singleton03() {}

    // 2. 静态内部类
    private static class SingletonHolder {
        private static final Singleton03 INSTANCE = new Singleton03();
    }

    // 3. 获取单例的方法
    public static Singleton03 getInstance() {
        return SingletonHolder.INSTANCE;
    }
}
